package com.bwie.controller;

import com.bwie.common.domain.Happy;
import com.bwie.common.result.Result;
import com.bwie.service.HappyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author：Minxiao Hao
 * @Description:
 * @name：HappyController
 * @Date：2024/11/4 11:28
 */
@RestController
@RequestMapping("/happy")
public class HappyController {
    @Autowired
    private HappyService happyService;

    /**
     * 抽奖活动 列表展示
     * @return
     */
    @GetMapping("/findHappyList")
    public Result<Happy> findHappyList(){
        List<Happy> list = happyService.findHappyList();
        Result result = Result.success(list);
        return result;
    }

    /**
     * 抽奖 大转盘
     * @param happy
     * @return
     */
    @PostMapping("/happyTake")
    public Result<Happy> happyTake(Happy happy){
        Happy happy1 = happyService.happyTake(happy);
        Result result = Result.success(happy1);
        return result;
    }
}
